﻿
namespace UTable.Core.Input
{
    /// <summary>
    /// Base class of InputEventArgs
    /// </summary>
    public abstract class InputEventArgs
    {
        #region Private Members

        private long _timestamp;
        private bool _handled = false;
        private bool _routeDown = true;
        private object _source = null;

        #endregion

        #region Properties

        /// <summary>
        /// Gets the time when this event occurred.
        /// </summary>
        public long Timestamp
        {
            get { return _timestamp; }
        }

        /// <summary>
        ///  Gets or sets a value that indicates the present state of the event handling
        ///  for a routed event as it travels the route.
        /// </summary>
        /// <return>
        /// If setting, set to true if the event is to be marked handled; otherwise false.
        /// If reading this value, true indicates that either a class handler, or some
        /// instance handler along the route, has already marked this event handled.
        /// false.indicates that no such handler has marked the event handled.  
        /// 
        /// The control that is receiving this event can respond to it differently according to 
        /// this value. Especially, the object will not be moved by the finger 
        /// if the finger's event is handled in the control tree
        /// 
        /// The default value is false.
        /// </return>
        public bool Handled
        {
            get { return _handled; }
            set { _handled = value; }
        }

        /// <summary>
        /// Gets or sets a value that indicates whether this event should be route down
        /// </summary>
        /// <return>
        /// If set to true, then the event will be routed to the control below the control receiving this event;
        /// otherwise false. 
        /// The default value is true
        /// </return>
        public bool RouteDown
        {
            get { return _routeDown; }
            set { _routeDown = value; }
        }

        /// <summary>
        /// Gets the original reporting source as determined by pure hit testing
        /// </summary>
        public object Source
        {
            get { return _source; }
            internal set { _source = value; }
        }

        #endregion

        #region Constructor

        public InputEventArgs(long ts)
        {
            _timestamp = ts;
        }

        #endregion

    }
}
